﻿/*----------------------------------------------------------------
//   Copyright (C) 2012 YMSOFT All rights reserved 
//
//   CLR版本:   2.0.50727.3634
//   Namespace: ART.Common
//   FileName : FusionCharts
//   Description: 
// 
//   Created by YAOMING at 2012-10-11 16:01:34
//   http://www.loverer.com QQ:78867011
//
//   Modified: 
//   Modify description: 
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;

namespace ART.Common
{
    public class FusionCharts
    {
        public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode)
        {
            return smethod_0(chartSWF, strURL, strXML, chartId, chartWidth, chartHeight, debugMode, false, false);
        }

        public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS)
        {
            return smethod_0(chartSWF, strURL, strXML, chartId, chartWidth, chartHeight, debugMode, registerWithJS, false);
        }

        public static string RenderChartHTML(string chartSWF, string strURL, string strXML, string chartId, string chartWidth, string chartHeight, bool debugMode, bool registerWithJS, bool transparent)
        {
            return smethod_0(chartSWF, strURL, strXML, chartId, chartWidth, chartHeight, debugMode, registerWithJS, transparent);
        }

        private static string smethod_0(string string_0, string string_1, string string_2, string string_3, string string_4, string string_5, bool bool_0, bool bool_1, bool bool_2)
        {
            StringBuilder builder = new StringBuilder();
            string str = string.Empty;
            if (string_2.Length != 0)
            {
                str = string.Format("&chartWidth={0}&chartHeight={1}&debugMode={2}&registerWithJS={3}&DOMId={4}&dataXML={5}", new object[] { string_4, string_5, BoolToInt(bool_0), BoolToInt(bool_1), string_3, string_2 });
            }
            else
            {
                str = string.Format("&chartWidth={0}&chartHeight={1}&debugMode={2}&registerWithJS={3}&DOMId={4}&dataURL={5}", new object[] { string_4, string_5, BoolToInt(bool_0), bool_1, string_3, string_1 });
            }
            builder.AppendFormat("<!-- START Code Block for Chart {0} -->" + Environment.NewLine, string_3);
            builder.AppendFormat("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"{0}\" height=\"{1}\" name=\"{2}\" id==\"{2}\" >" + Environment.NewLine, string_4, string_5, string_3);
            builder.Append("<param name=\"allowScriptAccess\" value=\"always\" />" + Environment.NewLine);
            builder.AppendFormat("<param name=\"movie\" value=\"{0}\"/>" + Environment.NewLine, string_0);
            builder.AppendFormat("<param name=\"FlashVars\" value=\"{0}\" />" + Environment.NewLine, str);
            builder.Append("<param name=\"quality\" value=\"high\" />" + Environment.NewLine);
            string str2 = "";
            if (bool_2)
            {
                builder.Append("<param name=\"wmode\" value=\"transparent\" />" + Environment.NewLine);
                str2 = "wmode=\"transparent\"";
            }
            builder.AppendFormat("<embed src=\"{0}\" FlashVars=\"{1}\" quality=\"high\" width=\"{2}\" height=\"{3}\" name=\"{4}\" id=\"{4}\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" {5} />" + Environment.NewLine, new object[] { string_0, str, string_4, string_5, string_3, str2 });
            builder.Append("</object>" + Environment.NewLine);
            builder.AppendFormat("<!-- END Code Block for Chart {0} -->" + Environment.NewLine, string_3);
            return (("<div id='" + string_3 + "Div'>") + builder.ToString() + "</div>");
        }

        private static int BoolToInt(bool bool_0)
        {
            return (bool_0 ? 1 : 0);
        }

    }
}
